package com.xintoucloud.pbs.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.xintoucloud.pbs.dao.PermissionMenuDao;
import com.xintoucloud.pbs.entity.PermissionMenu;
@Repository
public class PermissionMenuDaoImpl implements PermissionMenuDao{

	@Autowired
	private SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<PermissionMenu> listByppid(int ppid) {
		return sessionFactory.getCurrentSession().createQuery("from PermissionMenuDao where ppid=?0")
				.setParameter(0, ppid)
				.getResultList();
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<PermissionMenu> listBypmid(int pmid) {
		return sessionFactory.getCurrentSession().createQuery("from PermissionMenuDao where pmid=?0")
				.setParameter(0, pmid)
				.getResultList();
	}

}
